<?php

namespace haibao\tv\business\payment;

use \haibao\tv\business\BusinessException;

class TvVipProduct extends \haibao\tv\business\Base{
    
    /**
	 * @var $_instance
	 */
	private static $_instance;
	
	/**
	 * instance()
	 */
	private static function instance(){
		if(!self::$_instance){
			self::$_instance = new \haibao\tv\data\payment\TvVipProduct();
		}
		return self::$_instance;
	}
	
	/**
	 * 获取vip套餐信息
	 */
	public static function getVipProduct(){
	    $product = self::instance()->getVipProduct();
	    if($product){
    	    foreach ($product as $key=>$val){
    	        $product[$key]['ProductPrice'] = intval($val['ProductPrice']);
    	    }
	    }
	    return $product;
	}
	
	/**
	 * 根据商品Id查询套餐信息
	 */
	public static function getProductByProductId($productId){
	    $productId = intval($productId);
	    $product = self::instance()->getProductByProductId($productId);
	    if(!$product){
	        throw new BusinessException('套餐不存在');
	    }
	    return $product;
	}

} 